<<<<<<< HEAD
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Report extends CI_Controller {
	
	function __construct(){
		parent::__construct();
		exit;
	}
	function index(){
		$data = array();
		$today = strtotime(date('Y-m-d'));
		//构建最近15天的时间数组
		$days = array();
		$onedaytime = 3600*24;
		for($i = 15; $i>0 ; $i --){
			$days[] = $today - $i*$onedaytime;
		}
		$this->load->model('Mydb_model');
		$x = array();
		$y = array();
		$z = array();
		foreach($days as $d){
			//当天成交量
			$start = $d;
			$x[]=date('d',$d);
			$end = $d+(3600*24);
			$sql = "SELECT SUM(p1.account) AS account FROM rsh_borrow_tender AS p1 
		LEFT JOIN rsh_borrow AS p2 ON p1.borrow_id = p2.id 
		WHERE (p2.ftype!=4 AND p2.fstatus=3 AND p2.repayment_time >= {$start} AND p2.repayment_time < {$end}) 
		OR (p2.ftype=4 AND p1.add_time>={$start} AND p1.add_time<{$end})";
			//$row = $mysql->db_fetch_array($sql);
			$row = $this->Mydb_model->query_sql($sql,'row');
			//$data[$d] = round($row['account'],0);
			$y[]=round($row['account'],0);
			$sql = "SELECT COUNT(DISTINCT p1.user_id) AS account FROM rsh_borrow_tender AS p1 
		LEFT JOIN rsh_borrow AS p2 ON p1.borrow_id = p2.id 
		WHERE (p2.ftype!=4 AND p2.fstatus=3 AND p2.repayment_time >= {$start} AND p2.repayment_time < {$end}) 
		OR (p2.ftype=4 AND p1.add_time>={$start} AND p1.add_time<{$end})";
			//$row = $mysql->db_fetch_array($sql);
			$row = $this->Mydb_model->query_sql($sql,'row');
			$z[]=round($row['account'],0);//$row['account'];
		
		}
		$data['x'] = $x;
		$data['y'] = $y;
		$data['z'] = $z;
		$this->load->view('report',$data);
	}
=======
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Report extends CI_Controller {
    
	function __construct(){
		parent::__construct();
		exit;
	}
	function index(){
		$data = array();
		$today = strtotime(date('Y-m-d'));
		//构建最近15天的时间数组
		$days = array();
		$onedaytime = 3600*24;
		for($i = 15; $i>0 ; $i --){
			$days[] = $today - $i*$onedaytime;
		}
		$this->load->model('Mydb_model');
		$x = array();
		$y = array();
		$z = array();
		foreach($days as $d){
			//当天成交量
			$start = $d;
			$x[]=date('d',$d);
			$end = $d+(3600*24);
			$sql = "SELECT SUM(p1.account) AS account FROM rsh_borrow_tender AS p1 
		LEFT JOIN rsh_borrow AS p2 ON p1.borrow_id = p2.id 
		WHERE (p2.ftype!=4 AND p2.fstatus=3 AND p2.repayment_time >= {$start} AND p2.repayment_time < {$end}) 
		OR (p2.ftype=4 AND p1.add_time>={$start} AND p1.add_time<{$end})";
			//$row = $mysql->db_fetch_array($sql);
			$row = $this->Mydb_model->query_sql($sql,'row');
			//$data[$d] = round($row['account'],0);
			$y[]=round($row['account'],0);
			$sql = "SELECT COUNT(DISTINCT p1.user_id) AS account FROM rsh_borrow_tender AS p1 
		LEFT JOIN rsh_borrow AS p2 ON p1.borrow_id = p2.id 
		WHERE (p2.ftype!=4 AND p2.fstatus=3 AND p2.repayment_time >= {$start} AND p2.repayment_time < {$end}) 
		OR (p2.ftype=4 AND p1.add_time>={$start} AND p1.add_time<{$end})";
			//$row = $mysql->db_fetch_array($sql);
			$row = $this->Mydb_model->query_sql($sql,'row');
			$z[]=round($row['account'],0);//$row['account'];
		
		}
		$data['x'] = $x;
		$data['y'] = $y;
		$data['z'] = $z;
		$this->load->view('report',$data);
	}
>>>>>>> d47623b610d79a4eeb489500830c00d70933f414
}